package com.ruoyi.system.enums;

import com.ruoyi.system.domain.ActivePrizeConfig;
import lombok.Getter;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Getter
public enum ActivePrizeEnum {
    PRIZE1("奖品1", "", new BigDecimal("0.20")),
    PRIZE2("奖品2", "", new BigDecimal("0.25")),
    PRIZE3("奖品3", "", new BigDecimal("0.50")),
    PRIZE4("奖品4", "", new BigDecimal("0.75")),
    PRIZE5("奖品5", "", new BigDecimal("0.80")),
    PRIZE6("奖品6", "", new BigDecimal("1.20")),
    PRIZE7("奖品7", "", new BigDecimal("1.30")),
    PRIZE8("奖品8", "", new BigDecimal("1.60")),
    PRIZE9("奖品9", "", new BigDecimal("2.40")),
    PRIZE10("奖品10", "", new BigDecimal("2.60")),
    PRIZE11("奖品11", "", new BigDecimal("3.90")),
    PRIZE12("奖品12", "", new BigDecimal("10.00")),
    ;

    private final String prizeName;

    private final String prizeImg;

    private final BigDecimal proportion;

    ActivePrizeEnum(String prizeName, String prizeImg, BigDecimal proportion) {
        this.prizeName = prizeName;
        this.prizeImg = prizeImg;
        this.proportion = proportion;
    }

    public static List<ActivePrizeConfig> initPrize(Long boxId) {
        return Arrays.stream(ActivePrizeEnum.values()).map(v ->
                ActivePrizeConfig.builder()
                        .boxId(boxId)
                        .name(v.getPrizeName())
                        .img(v.getPrizeImg())
                        .proportion(v.getProportion())
                        .build()
        ).collect(Collectors.toList());
    }
}
